package com.zoshine.zzg.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.zoshine.zzg.base.Pagination;
import com.zoshine.zzg.pojo.pojostatus.CommonStatus;

import java.util.Objects;

/**
 * 用户表
 * @author 田沛凌
 * @time 2017年6月20日 下午4:14:20
 */
public class User extends Pagination{
	private static final long serialVersionUID = 7455282981025689361L;
    /**超级管理编号*/
	private static final long SUPER_ADMIN_ID = 0L;

	/**角色ID*/
	private Long roleId;
	
	/**角色名*/
	private String roleName;
	
	/**组织ID*/
	private Long orgId;
	
	/**组织名*/
	private String orgName;
	
	/**用户名*/
    private String username;

    /**密码*/
    @JSONField(serialize = false)
    private String password;

    /**盐*/
    @JSONField(serialize = false)
    private String salt;

    /**状态*/
    private Integer userStatus;

    /**真空姓名*/
    private String realName;

	/**
	 * 是否为超级管理员
	 */
	@JSONField(serialize = false)
	public boolean isSuperAdmin() {
        return Objects.equals(getId(), SUPER_ADMIN_ID);
	}

	//====get/set

    public String getUserStatusStr(){
    	return CommonStatus.getDesc(userStatus);
    }
    
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getSalt() {
        return salt;
    }

    public void setSalt(String salt) {
        this.salt = salt == null ? null : salt.trim();
    }


	public Integer getUserStatus() {
		return userStatus;
	}

	public void setUserStatus(Integer userStatus) {
		this.userStatus = userStatus;
	}


	public Long getRoleId() {
		return roleId;
	}

	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public String getRoleName() {
		return roleName;
	}

	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}

	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}
}